<?php
//error_reporting(0);//屏蔽错误显示
include_once('includes/class/cwbgj.class.php');
//requit imgStr start $_POST
//if (!empty($_POST['cwbCon'])){
if (!empty($_POST['cwbCon']) || !empty($_POST['imgUpload'])){

$wbTitle = trim($_POST['wbTitle']);
$wbName = trim($_POST['wbName']);
$fFont = trim($_POST['fFont']);
$cwbCon = trim($_POST['cwbCon']);
$imgUpload = trim($_POST['imgUpload']);

$api_url = 'http://www.cwbgj.com/api.php';
$cwbgj = new Cwbgj;
$api_input["key"] = 'qq202524';
$api_input["format"] = 'json';
$api_input["wbTitle"] = $wbTitle;
$api_input["wbName"] = $wbName;
$api_input["fFont"] = $fFont;
$api_input["cwbCon"] = $cwbCon;
$api_input["imgUpload"] = $imgUpload;
$cwbgj->submit($api_url,$api_input);
$return= $cwbgj->results;

$arr = json_decode($return,1);

$stxt = $arr['txt'];
$surl = $arr['shareurl'];
$spic = $arr['imgurl'];

//输出内容
$cwbConHtml =<<<CWBCONHTML
<!--// con start-->
    <div class="sharePic">
<h3>你可以点击以下按钮直接将该长微博发布到：</h3>
1 . 新浪微博 ：<span id="sinaWbBtn"></span>
<script type="text/javascript" charset="utf-8">
(function(){
  var _w = 142 , _h = 32;
  var param = {
    url:'$surl', /**location.href*/
    type:'4',
    count:'', /**是否显示分享数，1显示(可选)*/
    appkey:'2026748624', /**您申请的应用appkey,显示分享来源(可选)*/
    title:'$stxt', /**分享的文字内容(可选，默认为所在页面的title)*/
    pic:"$spic", /**分享图片的路径(可选)*/
    ralateUid:'2543374003', /**关联用户的UID，分享微博会@该用户(可选)2314581331*/
	language:'zh_cn', /**设置语言，zh_cn|zh_tw(可选)*/
    rnd:new Date().valueOf()
  }
  var temp = [];
  for( var p in param ){
    temp.push(p + '=' + encodeURIComponent( param[p] || '' ) )
  }
  $("#sinaWbBtn").html('<iframe allowTransparency="true" frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?' + temp.join('&') + '" width="'+ _w+'" height="'+_h+'"></iframe>')
})()
</script>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 . 腾讯微博 ：
<a href="javascript:void(0)" onclick="postToWb();return false;" class="tmblog" title="分享到腾讯微博"><img src="http://v.t.qq.com/share/images/s/b32.png" border="0"></a><script type="text/javascript">
	function postToWb(){
		var _url = encodeURIComponent('$surl');//document.location
		var _assname = encodeURI("varsoft");//你注册的帐号，不是昵称
		var _appkey = encodeURI("801005913");//你从腾讯获得的appkey
		var _pic = encodeURI('$spic');//（例如：var _pic='图片url1|图片url2|图片url3....）
		var _t = '$stxt';//标题和描述信息
		/* _t =  document.title+_t; */;
		if(_t.length > 120){
			_t= _t.substr(0,100)+'...';
		}
		_t = _t + '(分享自 @varsoft ) ';
		//请在这里添加你自定义的分享内容
		_t = encodeURIComponent(_t);

		var _u = 'http://share.v.t.qq.com/index.php?c=share&a=index&url='+_url+'&appkey='+_appkey+'&pic='+_pic+'&assname='+_assname+'&title='+_t;
		window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
	}
</script>
<br>
<br>
<iframe src="http://cwb.jayxun.com/baidu_share.php?title=$stxt&url=$surl&pic=$spic" width="686" height="27" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
<h3>或者你也可以：</h3>
查看该图片/地址 : <a href="$spic" target="_blank">$spic</a>
<br>
该图片链接将为您保存一小时, 一个小时后即将自动删除, 请及时分享或者保存到本地;
<!--//
<h3>如果想外链本图片地址请注意：</h3>
近期新浪微博将对分享按钮直接发布的图片高度超过690像素的进行压缩，会导致图片模糊，如果您的图文过长，请手动上传。 
-->
<br><br>
o(>﹏<)o~ <a onclick="resetCwb();">点这里返回继续转换其他内容 >></a>
    </div><!--//.sharePic  -->
<!--// con end-->
<br><br>
<center>
<div id="ggAdCon">
<iframe width="728" height="90" frameborder="0" scrolling="no" src="http://www.cwbgj.com/ads_728_90_2.html"></iframe>
</div>
</center>
CWBCONHTML;
//输出内容

$response = array();
$response['status'] = $arr['status'];
$response['cwbCon'] = $cwbConHtml;
echo json_encode($response);

}
?>